package cn.cnf.service;


import cn.cnf.common.enums.MoneyRecordType;
import cn.cnf.common.enums.WorkType;
import cn.cnf.entity.MoneyRecord;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;

import java.math.BigDecimal;

/**
 * 服务接口
 *
 * @author ZhuMeiYi
 * @since 2021-01-10 23:11:44
 * @description 
 */
public interface MoneyRecordService extends IService<MoneyRecord> {

    boolean addRecord(String fromId, String fromName, String toId, String toName, BigDecimal num, MoneyRecordType type);

    IPage<MoneyRecord> getRecord(Integer current, Integer pageSize,String fromName,String toName,MoneyRecordType type,String time);

    /**
     * 打赏作品
     * @param currentUserName
     * @param workId
     * @param byValue
     * @param money
     * @return
     */
    String rewardsWork(String currentUserName, String workId, WorkType byValue, BigDecimal money);

    /**
     *
     * @param useKey
     * @param num
     * @param idOrName
     * @return
     */
    BigDecimal adjustUserMoney(String useKey, BigDecimal num, boolean idOrName);

    /**
     * 转账操作
     * @param fromId
     * @param toId
     * @param num
     * @return
     */
    boolean transferMoney(String fromId, String toId,BigDecimal num);
}
